'use strict'

class timeletter{

  constructor (mdb) {
    this.mdb = mdb || null
  }

  async insert(d) {
    console.log(d)
    console.log(JSON.parse(d))
    /*
    let sql='select * from timeletter'
    let r=await this.mdb.query(sql)
    let letterid=r['rows'].length+1;
    console.log('letterid:',letterid)
    let data=JSON.parse(d)
    //return {'letterid':letterid}
     
    this.mdb.connect().then(client=>{
      client.query('insert into timeletter values($1::int,$2::timestamp,$3::int,$4::int,$5::text,$6::varchar,$7::varchar,$8::int)',[letterid,data.lettertime,data.themeid,data.backimgid,data.content,'免费',data.lettertcolor,data.lettertstyleid]).then(res=>{
        return {"letterid":letterid}
      })
    })
    */
  }
 
}

module.exports = timeletter
